<template>
  <div id="ghsjAndssfaPingShenInsert">
    <div class="MainBox" v-show="flag==1">
      <div class="boxItem">
        <div class="boxItem_title">
          <span class="tit">前期测绘审定信息</span>
        </div>
        <div class="boxItem_content" style="padding-top:35px;">
          <el-row :gutter="20">
            <el-col :span="8">
              <div class="boxItem_content_title">
                <p>实施方案编制单位：</p>
                <el-tooltip
                  class="item"
                  effect="dark"
                  :content="mainData.name"
                  placement="top-start"
                >
                  <div class="boxItem_content_row_item_input">
                    <el-input readonly v-model="mainData.name" suffix placeholder></el-input>
                  </div>
                </el-tooltip>
              </div>
            </el-col>
            <el-col :span="8">
              <div class="boxItem_content_title">
                <p>复垦点个数：</p>
                <div class="boxItem_content_row_item_input">
                  <el-input readonly v-model="mainData.reclaimNum" suffix placeholder></el-input>
                  <span class="inputEndText span">个</span>
                </div>
              </div>
            </el-col>
            <el-col :span="8">
              <div class="boxItem_content_title">
                <p>复垦规模：</p>
                <div class="boxItem_content_row_item_input">
                  <el-input readonly v-model="mainData.reclaimScale" suffix placeholder></el-input>
                  <span class="inputEndText span">m²</span>
                </div>
              </div>
            </el-col>
          </el-row>

          <el-row :gutter="20">
            <el-col :span="8">
              <div class="boxItem_content_title">
                <p>开始时期：</p>
                <div class="boxItem_content_row_item_input">
                  <el-date-picker
                    class="boxItem_content_row_item_input"
                    v-model="submitData.beginDate"
                    type="datetime"
                    value-format="yyyy-MM-dd HH:mm:ss"
                    placeholder="选择日期时间"
                  ></el-date-picker>
                </div>
              </div>
            </el-col>
            <el-col :span="8">
              <div class="boxItem_content_title">
                <p>完成日期：</p>
                <div class="boxItem_content_row_item_input">
                  <!-- <el-input v-model="submitData.finishDate" suffix placeholder="请输入内容"></el-input> -->
                  <el-date-picker
                    class="boxItem_content_row_item_input"
                    v-model="submitData.finishDate"
                    type="datetime"
                    value-format="yyyy-MM-dd HH:mm:ss"
                    placeholder="选择日期时间"
                  ></el-date-picker>
                </div>
              </div>
            </el-col>
            <el-col :span="8">
              <div class="boxItem_content_title">
                <p>编制技术负责人：</p>
                <div class="boxItem_content_row_item_input">
                  <el-select
                    @change="selectPerson"
                    class="boxItem_content_row_item_input"
                    filterable
                    clearable
                    v-model="submitData.technicalDirectorId"
                    placeholder="请选择"
                  >
                    <el-option
                      v-for="item in technicalDirectorList"
                      :key="item.userId"
                      :label="item.name"
                      :value="item.userId"
                    ></el-option>
                  </el-select>
                </div>
              </div>
            </el-col>
          </el-row>
        </div>
      </div>
      <div class="boxItem">
        <div class="boxItem_title">
          <span class="tit">实施方案评审信息</span>
        </div>
        <div class="boxItem_content" style="padding-top:35px;">
          <el-row :gutter="20">
            <el-col :span="8">
              <div class="boxItem_content_title">
                <p>复核日期：</p>
                <div class="boxItem_content_row_item_input">
                  <el-date-picker
                    class="boxItem_content_row_item_input"
                    v-model="submitData.checkDate"
                    type="datetime"
                    value-format="yyyy-MM-dd HH:mm:ss"
                    placeholder="选择日期时间"
                  ></el-date-picker>
                </div>
              </div>
            </el-col>
            <el-col :span="8">
              <div class="boxItem_content_title">
                <p>评审人员：</p>
                <div class="boxItem_content_row_item_input">
                  <el-input v-model="submitData.commentPeopleName" suffix placeholder="请输入内容"></el-input>
                  <!-- <el-select
                  class="boxItem_content_row_item_input"
                  v-model="submitData.commentPeopleName"
                  placeholder="请选择"
                >
                  <el-option
                    v-for="item in technicalDirectorList"
                    :key="item.userId"
                    :label="item.name"
                    :value="item.userId"
                  ></el-option>
                  </el-select>-->
                </div>
              </div>
            </el-col>
            <el-col :span="8">
              <div class="boxItem_content_title">
                <p>评审负责人：</p>
                <div class="boxItem_content_row_item_input">
                  <el-input
                    v-model="submitData.commentResponsiblePeopleName"
                    suffix
                    placeholder="请输入内容"
                  ></el-input>
                  <!-- <el-select
                  class="boxItem_content_row_item_input"
                  v-model="submitData.commentResponsiblePeopleName"
                  placeholder="请选择"
                >
                  <el-option
                    v-for="item in technicalDirectorList"
                    :key="item.userId"
                    :label="item.name"
                    :value="item.userId"
                  ></el-option>
                  </el-select>-->
                </div>
              </div>
            </el-col>
          </el-row>
        </div>
      </div>
      <div class="boxItem">
        <div class="boxItem_title">
          <span class="tit">实施方案审定面积信息</span>
        </div>
        <div class="boxItem_content" style="padding-top:35px;">
          <el-row :gutter="20">
            <el-col :span="8">
              <div class="boxItem_content_title">
                <p>复垦点个数：</p>
                <div class="boxItem_content_row_item_input">
                  <el-input v-model="submitData.fkdgs" readonly suffix placeholder="请输入内容"></el-input>
                </div>
              </div>
            </el-col>
            <el-col :span="8">
              <div class="boxItem_content_title">
                <p>实施规模：</p>
                <div class="boxItem_content_row_item_input">
                  <el-input type="number" v-model="submitData.ssgm" suffix placeholder="请输入内容"></el-input>
                  <span class="inputEndText span">公顷</span>
                </div>
              </div>
            </el-col>
            <el-col :span="8">
              <div class="boxItem_content_title">
                <p>预计减少建设用地面积：</p>
                <div class="boxItem_content_row_item_input">
                  <el-input type="number" v-model="submitData.yjjsj" suffix placeholder="请输入内容"></el-input>
                  <span class="inputEndText span">公顷</span>
                </div>
              </div>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="8">
              <div class="boxItem_content_title">
                <p>预计新增耕地面积：</p>
                <div class="boxItem_content_row_item_input">
                  <el-input type="number" v-model="submitData.yjzjg" suffix placeholder="请输入内容"></el-input>
                  <span class="inputEndText span">公顷</span>
                </div>
              </div>
            </el-col>
            <el-col :span="8">
              <div class="boxItem_content_title">
                <p>预计新增其他农用地面积：</p>
                <div class="boxItem_content_row_item_input">
                  <el-input type="number" v-model="submitData.yjzjq" suffix placeholder="请输入内容"></el-input>
                  <span class="inputEndText span">公顷</span>
                </div>
              </div>
            </el-col>
          </el-row>
        </div>
      </div>
      <div class="boxItem">
        <div class="boxItem_title">
          <span class="tit">预算投资</span>
        </div>
        <div class="boxItem_content" style="padding-top:35px;">
          <el-row :gutter="20">
            <el-col :span="2">
              <p class="freeTitle">工程施工费</p>
            </el-col>
            <el-col :span="22">
              <el-row>
                <el-col :span="8">
                  <div class="boxItem_content_title">
                    <p>拆除工程费：</p>
                    <div class="boxItem_content_row_item_input">
                      <el-input
                        v-model="submitData.demolitionCost"
                        type="number"
                        @input="countMoney"
                        suffix
                        min="0"
                        placeholder="请输入内容"
                      ></el-input>

                      <span class="inputEndText span">万元</span>
                    </div>
                  </div>
                </el-col>
                <el-col :span="8">
                  <div class="boxItem_content_title">
                    <p>土地平整工程费：</p>
                    <div class="boxItem_content_row_item_input">
                      <el-input
                        v-model="submitData.landLevelingCost"
                        type="number"
                        @input="countMoney"
                        suffix
                        min="0"
                        placeholder="请输入内容"
                      ></el-input>

                      <span class="inputEndText span">万元</span>
                    </div>
                  </div>
                </el-col>
                <el-col :span="8">
                  <div class="boxItem_content_title">
                    <p>农田水利工程费：</p>
                    <div class="boxItem_content_row_item_input">
                      <el-input
                        v-model="submitData.farmlandWaterConservancyCost"
                        type="number"
                        @input="countMoney"
                        suffix
                        min="0"
                        placeholder="请输入内容"
                      ></el-input>

                      <span class="inputEndText span">万元</span>
                    </div>
                  </div>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                  <div class="boxItem_content_title">
                    <p>田间道路工程费：</p>
                    <div class="boxItem_content_row_item_input">
                      <el-input
                        v-model="submitData.fieldRoadCost"
                        type="number"
                        @input="countMoney"
                        suffix
                        min="0"
                        placeholder="请输入内容"
                      ></el-input>

                      <span class="inputEndText span">万元</span>
                    </div>
                  </div>
                </el-col>
                <el-col :span="8">
                  <div class="boxItem_content_title">
                    <p>其他施工费：</p>
                    <div class="boxItem_content_row_item_input">
                      <el-input
                        v-model="submitData.otherConstructingCost"
                        type="number"
                        @input="countMoney"
                        suffix
                        min="0"
                        placeholder="请输入内容"
                      ></el-input>
                      <span class="inputEndText span">万元</span>
                    </div>
                  </div>
                </el-col>
              </el-row>
            </el-col>
          </el-row>

          <el-row :gutter="20">
            <el-col :span="2">
              <p class="freeTitle">其他费用</p>
            </el-col>
            <el-col :span="22">
              <el-row :gutter="20">
                <el-col :span="8">
                  <div class="boxItem_content_title">
                    <p>前期工作费：</p>
                    <div class="boxItem_content_row_item_input">
                      <el-input
                        v-model="submitData.qqgzf"
                        type="number"
                        @input="countMoney"
                        suffix
                        min="0"
                        placeholder="请输入内容"
                      ></el-input>

                      <span class="inputEndText span">万元</span>
                    </div>
                  </div>
                </el-col>
                <el-col :span="8">
                  <div class="boxItem_content_title">
                    <p>工程监理费：</p>
                    <div class="boxItem_content_row_item_input">
                      <el-input
                        v-model="submitData.gcjlf"
                        type="number"
                        @input="countMoney"
                        suffix
                        min="0"
                        placeholder="请输入内容"
                      ></el-input>

                      <span class="inputEndText span">万元</span>
                    </div>
                  </div>
                </el-col>
                <el-col :span="8">
                  <div class="boxItem_content_title">
                    <p>设备购置费：</p>
                    <div class="boxItem_content_row_item_input">
                      <el-input
                        v-model="submitData.sbgzf"
                        type="number"
                        @input="countMoney"
                        suffix
                        min="0"
                        placeholder="请输入内容"
                      ></el-input>

                      <span class="inputEndText span">万元</span>
                    </div>
                  </div>
                </el-col>
              </el-row>
              <el-row :gutter="20">
                <el-col :span="8">
                  <div class="boxItem_content_title">
                    <p>竣工验收费：</p>
                    <div class="boxItem_content_row_item_input">
                      <el-input
                        v-model="submitData.jgysf"
                        type="number"
                        @input="countMoney"
                        suffix
                        min="0"
                        placeholder="请输入内容"
                      ></el-input>

                      <span class="inputEndText span">万元</span>
                    </div>
                  </div>
                </el-col>
                <el-col :span="8">
                  <div class="boxItem_content_title">
                    <p>业主管理费：</p>
                    <div class="boxItem_content_row_item_input">
                      <el-input
                        v-model="submitData.yzglf"
                        type="number"
                        @input="countMoney"
                        suffix
                        min="0"
                        placeholder="请输入内容"
                      ></el-input>

                      <span class="inputEndText span">万元</span>
                    </div>
                  </div>
                </el-col>
                <el-col :span="8">
                  <div class="boxItem_content_title">
                    <p>安全配套费：</p>
                    <div class="boxItem_content_row_item_input">
                      <el-input
                        v-model="submitData.aqptf"
                        type="number"
                        @input="countMoney"
                        suffix
                        min="0"
                        placeholder="请输入内容"
                      ></el-input>

                      <span class="inputEndText span">万元</span>
                    </div>
                  </div>
                </el-col>
              </el-row>
            </el-col>
          </el-row>
          <el-row :gutter="20" class="boxItem_content_row marginBottom">
            <el-col :span="2">
              <p class="freeTitle">不可预见费用</p>
            </el-col>
            <el-col :span="22">
              <div class="boxItem_content_row_item_input">
                <el-input
                  v-model="submitData.unforeseeableExpenses"
                  type="number"
                  @input="countMoney"
                  suffix
                  min="0"
                  placeholder="请输入内容"
                ></el-input>

                <span class="inputEndText span">万元</span>
              </div>
            </el-col>
          </el-row>
          <el-row :gutter="20" class="boxItem_content_row marginBottom">
            <el-col :span="2">
              <p class="freeTitle">补偿费</p>
            </el-col>
            <el-col :span="22">
              <div class="boxItem_content_row_item_input">
                <el-input
                  v-model="submitData.compensation"
                  type="number"
                  @input="countMoney"
                  suffix
                  min="0"
                  placeholder="请输入内容"
                ></el-input>

                <span class="inputEndText span">万元</span>
              </div>
            </el-col>
          </el-row>
          <el-row :gutter="20" class="boxItem_content_row">
            <el-col :span="2">
              <p class="totalMoney">合计：</p>
            </el-col>
            <el-col :span="22">
              <div class="boxItem_content_row_item_input">
                <el-input :readonly="true" v-model="heji" suffix placeholder="请输入内容"></el-input>
                <span class="inputEndText span">万元</span>
              </div>
            </el-col>
          </el-row>
        </div>
      </div>
      <div class="boxItem">
        <div class="boxItem_title">
          <span class="tit">测绘单位信息</span>
        </div>
        <div class="boxItem_content">
          <div class="boxItem_content_row">
            <div class="boxItem_content_row_item uploadDownLoadBox_item">
              <p>规划设计与实施方案成果模板</p>
              <el-button @click="download">下载</el-button>
            </div>
          </div>
          <div class="boxItem_content_row">
            <div class="boxItem_content_row_item uploadDownLoadBox_item">
              <p>规划设计与实施方案成果</p>
              <upload @beforeUpload="beforeUpload" @res="getRes" :accept="'.zip'" />
            </div>
          </div>
          <div class="uploadResult" v-if="isResult">
            <div class="boxItem_content_row" v-if="isResultFlag=='FAILURE'">
              <p class="uploadQuestionsTitle">上传的文件存在问题！</p>
              <el-button style="background: #e65f2e;color:white">导出系统自动检测意见</el-button>
            </div>
            <div class="boxItem_content_row marginTop20">
              <p>上传结果</p>
              <el-select v-model="resultValue" placeholder="--请选择--" style="margin:0px 20px;">
                <!-- <el-option label="--请选择--" value="0"></el-option> -->
                <el-option label="正常片块" value="true"></el-option>
                <el-option label="疑问片块" value="false"></el-option>
              </el-select>
              <el-button type="primary" :loading="isCheckLoading" @click="getEntryResult">查询</el-button>
            </div>

            <div class="marginTop20">
              <el-table :data="pianKuai" style="width: 100%">
                <el-table-column prop="landName" label="片块名称"></el-table-column>
                <el-table-column prop='' label="布局图">
                  <template slot-scope="scope">
                    <span :class="scope.row.engineeringMapFlag=='false'?'uploadQuestionsTitle':''">{{scope.row.engineeringMapStatus}}</span>
                  </template>
                </el-table-column>
                <el-table-column prop="geomResult" label="规划图">
                  <template slot-scope="scope">
                    <span
                      :class="scope.row.planningMapFlag=='false'?'uploadQuestionsTitle':''"
                    >{{scope.row.planningMapStatus}}</span>
                  </template>
                </el-table-column>
                
              </el-table>
              <div class="pageStyle">
                <el-pagination
                  @size-change="handleSizeChange"
                  @current-change="handleCurrentChange"
                  :current-page="needInfo.page"
                  :page-sizes="[10, 20, 30, 40]"
                  :page-size="needInfo.size"
                  layout="total, sizes, prev, pager, next, jumper"
                  :total="total"
                ></el-pagination>
              </div>
            </div>
            <div class="marginTop20">
              <div class="title">附件信息</div>
              <el-table :data="xiangMu" border style="width: 100%">
                <el-table-column prop="fileName" label="附件名称"></el-table-column>
                <el-table-column prop label="状态">
                  <template slot-scope="scope">
                    <span
                      :class="scope.row.flag=='false'?'uploadQuestionsTitle':''"
                    >{{scope.row.fileStatus}}</span>
                  </template>
                </el-table-column>
              </el-table>
            </div>
          </div>
          <div class="boxItem_content_row button_box">
            <el-button
              class="button_box_item"
              :disabled="noUpload"
              :loading="isLoading"
              @click="submit"
              type="primary"
            >提交</el-button>
            <el-button class="button_box_item">取消</el-button>
          </div>
        </div>
      </div>
    </div>

    <!-- <el-dialog title="上传结果" :visible.sync="errorBoxFlag" class="errorBox">
      <div class="showTableBox">
        <div class="piankuaixinxi">
          <el-table :data="updateMessage" border style="width: 100%">
            <el-table-column prop="fileName" label="项目名称"></el-table-column>
            <el-table-column prop="fileStatus" label="上传结果"></el-table-column>
            <el-table-column prop="date"></el-table-column>
            <el-table-column prop="date"></el-table-column>
          </el-table>
        </div>
      </div>
    </el-dialog>-->
  </div>
</template>

<script>
import {
  queryProjectConstructingPlanInfo,
  saveData,
  saveAgain,
  echoLandInfo,
  echoFileInfo
} from "@/api/ghsjAndssfaPingShen";
import { upImg } from "@/api/upImg";
import { queryHistoryTaskBoolean } from "@/api/common";

import upload from "@/components/upload";
export default {
  components: {
    upload
  },
  data() {
    return {
      isSelectPeople: true, //是否选择人员
      noUpload: false,
      uploadText: "上传",
      fileData: {
        fileName: "",
        fileUrl: "",
        id: ""
      },
      flag: 1,
      value1: "",
      input: "",
      fuzerenCehui: "", //测绘负责人
      fuzerenCehuiJishu: "", //测绘技术负责人
      fuzerenCehuiList: [
        {
          //测绘负责人数组
          value: "选项1",
          label: "黄金糕"
        },
        {
          value: "选项2",
          label: "双皮奶"
        },
        {
          value: "选项3",
          label: "蚵仔煎"
        },
        {
          value: "选项4",
          label: "龙须面"
        },
        {
          value: "选项5",
          label: "北京烤鸭"
        }
      ],
      fuzerenCehuiJishuList: [
        {
          //测绘负责人数组
          value: "选项1",
          label: "人1"
        },
        {
          value: "选项2",
          label: "人2"
        }
      ],
      mainData: "", //主要数据
      submitData: {
        enterpriseId: "",
        projectId: "",
        beginDate: "", //开始时间
        finishDate: "", //完成时间
        technicalDirectorId: "", //编制技术负责人id
        checkDate: "", //复核日期
        commentPeopleName: "", //评审人员名字
        commentResponsiblePeopleName: "", //评审负责人名字
        fkdgs: "", //复垦点个数
        ssgm: "", //实施规模
        yjjsj: "", //预计减少建
        yjzjg: "", //预计增加耕
        yjzjq: "", //预计增加其
        demolitionCost: "", //拆除工程费
        farmlandWaterConservancyCost: "", //农田水利工程费
        fieldRoadCost: "", //田间道路工程费
        landLevelingCost: "", //工地平整费
        otherConstructingCost: "", //其他施工费
        otherCost: "", //其他费用
        unforeseeableExpenses: "", //不可预见费
        compensation: "", //补偿费
        planConstructingResultFileId: "", //规划设计与实施方案成果文件id
        qqgzf: "", //前期工作费
        gcjlf: "", //工程监理费
        sbgzf: "", //设备购置费
        jgysf: "", //竣工验收费
        yzglf: "", //业主管理费
        aqptf: "" //安全配套费
      },
      gongcheng: "", //工程施工费
      heji: "", //合计
      technicalDirectorList: [], //编制负责人数组
      bianzhiIDcard: "", //选择的编制负责人身份证
      bianzhiName: "", //选择的编制负责人姓名

      ifFlag: true,
      errorBoxFlag: false, //上传结果弹窗
      updateMessage: [],
      errData: "", //错误文件

      isLoading: false,

      isResult: false, //上传结果
      resultValue: "", //疑问值

      pianKuai: [], //片块信息
      xiangMu: [], //项目信息
      needInfo: {
        page: 1,
        size: 10
      },
      total: 0,

      isResultFlag:'',//判断上传结果（标题是否显示--到处疑问片块）
      isCheckLoading:false
    };
  },
  created() {
    this.getData();
    this.submitData.projectId = localStorage.getItem("projectId");
  },
  methods: {
    download() {
      var a = document.createElement("a");
      a.setAttribute("href", this.$https + "/pc/file/download?id=6475");
      a.setAttribute("download", ""); // download属性
      a.click();
    },
    //上传前
    beforeUpload() {
      this.noUpload = true;
    },
    //上传后
    getRes(res) {
      this.fileData.fileName = res.data.fileName;
      this.fileData.fileUrl = res.data.filePath;
      this.fileData.id = res.data.id;
      this.noUpload = false;
      this.$message({
        message: "上传成功",
        type: "success"
      });
    },
    //计算费用
    countMoney() {
      this.gongcheng =
        Number(
          this.submitData.demolitionCost != ""
            ? this.submitData.demolitionCost
            : 0
        ) +
        Number(
          this.submitData.farmlandWaterConservancyCost != ""
            ? this.submitData.farmlandWaterConservancyCost
            : 0
        ) +
        Number(
          this.submitData.fieldRoadCost != ""
            ? this.submitData.fieldRoadCost
            : 0
        ) +
        Number(
          this.submitData.landLevelingCost != ""
            ? this.submitData.landLevelingCost
            : 0
        ) +
        Number(
          this.submitData.otherConstructingCost != ""
            ? this.submitData.otherConstructingCost
            : 0
        );

      this.submitData.otherCost =
        Number(this.submitData.qqgzf != "" ? this.submitData.qqgzf : 0) +
        Number(this.submitData.gcjlf != "" ? this.submitData.gcjlf : 0) +
        Number(this.submitData.sbgzf != "" ? this.submitData.sbgzf : 0) +
        Number(this.submitData.jgysf != "" ? this.submitData.jgysf : 0) +
        Number(this.submitData.yzglf != "" ? this.submitData.yzglf : 0) +
        Number(this.submitData.aqptf != "" ? this.submitData.aqptf : 0);
      this.heji =
        Number(this.gongcheng != "" ? this.gongcheng : 0) +
        Number(
          this.submitData.otherCost != "" ? this.submitData.otherCost : 0
        ) +
        Number(
          this.submitData.unforeseeableExpenses != ""
            ? this.submitData.unforeseeableExpenses
            : 0
        ) +
        Number(
          this.submitData.compensation != "" ? this.submitData.compensation : 0
        );
    },

    //选择负责人
    selectPerson(val) {
      console.log(val, "选择的人");
      if (val == "") {
        this.isSelectPeople = true;
      } else {
        this.isSelectPeople = false;
      }
    },
    // checkLand(){//上传结果查询
    //   let obj = {
    //     projectId: localStorage.getItem("projectId"),
    //     page: this.needInfo.page,
    //     size: this.needInfo.size,
    //     status: this.resultValue
    //   };
    //   this.isCheckLoading=true
    //   echoLandInfo(obj).then(res => {
    //     this.isCheckLoading=false
    //     console.log(res, "成果录入回显");
    //     this.pianKuai = res.data.list;
    //     this.total = res.data.total;
    //   });
    // },
    getEntryResult() {
      //成果录入回显
      let obj = {
        projectId: localStorage.getItem("projectId"),
        page: this.needInfo.page,
        size: this.needInfo.size,
        status: this.resultValue!=''?this.resultValue:''
      };
      if(this.resultValue!=''){
        this.isCheckLoading=true
      }
      echoLandInfo(obj).then(res => {
        console.log(res, "成果录入回显");
        this.isCheckLoading=false
        this.pianKuai = res.data.list;
        this.total = res.data.total;
      }).catch(error=>{
        this.isResultFlag=false
      });;
    },
    getEntryFujian() {
      let obj = {
        projectId: localStorage.getItem("projectId")
      };
      echoFileInfo(obj).then(res => {
        console.log(res, "成果附件回显");
        this.xiangMu = res.data;
      });
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.needInfo.size = val;
      this.getEntryResult();
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.needInfo.page = val;
      this.getEntryResult();
    },

    //提交
    submit() {
      let that=this
      let obj1 = {
        process: "CONSTRUCTING_PLAN_RESULT_SAVE",
        projectId: localStorage.getItem("projectId")
      };
      queryHistoryTaskBoolean(obj1).then(res1 => {
       if (res1.data == true) {
          let obj = {
            planConstructingResultFileId: that.fileData.id,
            projectId: that.submitData.projectId
          };
          that.isLoading = true;
          saveAgain(obj).then(res => {
            
            that.isLoading = false;
            that.isResultFlag=res.data
            that.isResult = true;
            that.$nextTick(() => {
              that.getEntryResult();
              that.getEntryFujian();
            });
          }).catch(error=>{
            console.log(res, "再次录入");
            that.isLoading=false
          });
        }else{
          let data = that.submitData;
          data.planConstructingResultFileId = that.fileData.id;
          that.isLoading = true;
          saveData(data)
            .then(res => {
              that.isLoading = false;
              console.log(res, "首次录入");
              that.isResultFlag=res.data
              that.isResult = true;
              that.$nextTick(() => {
                that.getEntryResult();
                that.getEntryFujian();
              });
            })
            .catch(error => {
              that.isLoading = false;
            });
        }
      });
      // return;
      // if (this.ifFlag) {
      //   if (this.submitData.technicalDirectorId == "") {
      //     let obj = {
      //       name: this.bianzhiName,
      //       num: this.bianzhiIDcard
      //     };
      //     this.submitData["technicalDirector"] = obj;
      //   } else {
      //     this.submitData.technicalDirectorId = this.submitData.technicalDirectorId;
      //   }
      //   var data = this.submitData;

      //   data.planConstructingResultFileId = this.fileData.id;
      //   console.log(data, "rddddddd");

      //   this.isLoading = true;
      //   saveData(data)
      //     .then(res => {
      //       console.log(res);
      //       this.isLoading = false;
      //       this.errorBoxFlag = true;
      //       this.updateMessage = res.data;
      //       if (res.code == 1000) {
      //         this.$message({
      //           message: "提交成功",
      //           type: "success"
      //         });
      //       } else {
      //         console.log(res, "123");
      //         this.errData = res.data;
      //         this.ifFlag = false;
      //         //this.errorBoxFlag=true
      //       }
      //     })
      //     .catch(error => {
      //       this.isLoading = false;
      //     });
      // } else {
      //   let obj = {
      //     planConstructingResultFileId: this.fileData.id,
      //     projectId: this.submitData.projectId
      //   };
      //   this.isLoading = true;
      //   saveAgain(obj)
      //     .then(res => {
      //       console.log(res);
      //       this.isLoading = false;
      //       if (res.code == 1000) {
      //         this.$message({
      //           message: "提交成功",
      //           type: "success"
      //         });
      //       } else {
      //         this.errData = res.data;
      //         this.errorBoxFlag = true;
      //         this.ifFlag = false;
      //       }
      //     })
      //     .catch(error => {
      //       this.isLoading = false;
      //     });
      // }
    },
    getData() {
      var data = {
        projectId: localStorage.getItem("projectId")
      };
      queryProjectConstructingPlanInfo(data).then(res => {
        console.log(res, "编制技术人员");
        this.mainData = res.data;
        this.submitData.fkdgs = res.data.reclaimNum;
        this.submitData.enterpriseId = res.data.enterpriseId;
        this.technicalDirectorList = res.data.appUsers;
      });
    },
    toSeeTable(type) {
      if (type == 1) {
        this.flag = 2;
      }
    }
  }
};
</script>
<style scoped>
#ghsjAndssfaPingShenInsert {
  padding: 30px;
  box-sizing: border-box;
}
#ghsjAndssfaPingShenInsert .boxItem {
  width: 100%;
  background-color: #fff;
}
#ghsjAndssfaPingShenInsert .boxItem_title {
  width: 100%;
  background: #f8f8f8;
  height: 50px;
  border: 1px solid #efefef;
  overflow: hidden;
  color: #333;
  font-size: 18px;
  font-weight: bold;
  text-indent: 20px;
  line-height: 50px;
}
#ghsjAndssfaPingShenInsert .boxItem_content {
  width: 100%;
  border: 1px solid #ebebeb;
  border-top: none;
  padding: 30px;
  padding-top: 0;
  box-sizing: border-box;
}
#ghsjAndssfaPingShenInsert .boxItem_content_row {
  display: flex;
  align-items: center;
}
#ghsjAndssfaPingShenInsert .boxItem_content_row_item {
  display: flex;
  align-items: center;
}
#ghsjAndssfaPingShenInsert .boxItem_content_row_child {
  display: flex;
  align-items: center;
  margin-left: 130px;
}
#ghsjAndssfaPingShenInsert .boxItem_content_row_child_item {
  display: flex;
  align-items: center;
  margin-right: 50px;
}
#ghsjAndssfaPingShenInsert .boxItem_content_row_child p {
  font-size: 14px;
  line-height: 36px;
}
#ghsjAndssfaPingShenInsert .boxItem_content_row_item:nth-child(2n-1) {
  margin-right: 22%;
}
#ghsjAndssfaPingShenInsert .boxItem_content_row_item p {
  font-size: 14px;
  line-height: 36px;
  width: 172px;
}
#ghsjAndssfaPingShenInsert .boxItem_content_row_item .largeText {
  width: 172px;
}
#ghsjAndssfaPingShenInsert .boxItem_content_row_item .smallText {
  width: 142px;
}
#ghsjAndssfaPingShenInsert .boxItem_content_row_item p:last-child {
  width: 200px;
}
#ghsjAndssfaPingShenInsert .boxItem_content_row_item_noFlex {
  display: flex;
  width: 100%;
}
#ghsjAndssfaPingShenInsert .boxItem_content_row_item_noFlex p {
  font-size: 14px;
  line-height: 36px;
  width: 140px;
}
#ghsjAndssfaPingShenInsert .boxItem_content_row_item p:first-child {
  color: #444;
  font-weight: bold;
}
#ghsjAndssfaPingShenInsert .boxItem_content_row_item p:last-child {
  color: #666;
}
#ghsjAndssfaPingShenInsert .boxItem_content_row_item.uploadDownLoadBox_item {
  margin: 20px 0 0 0;
}
#ghsjAndssfaPingShenInsert .boxItem_content_row_item.uploadDownLoadBox_item p {
  width: 200px;
  margin-right: 20px;
}
#ghsjAndssfaPingShenInsert .button_box {
  margin-top: 54px;
}
#ghsjAndssfaPingShenInsert .button_box_item {
  margin-right: 10px;
}
#ghsjAndssfaPingShenInsert .boxItem_content_row_item_input {
  position: relative;
  width: 200px;
}
#ghsjAndssfaPingShenInsert .el-input__inner {
  padding-right: 50px;
}
#ghsjAndssfaPingShenInsert .boxItem_content_row_item_input .span {
  position: absolute;
  right: 10px;
  top: 3px;
  height: 36px;
  line-height: 36px;
  z-index: 1;
  color: #999;
}
#ghsjAndssfaPingShenInsert .table-doc-view {
  border-collapse: collapse;
}
#ghsjAndssfaPingShenInsert .table-doc-view tr,
.table-doc-view td {
  border: 1px solid #ccc;
  padding: 10px 10px;
}
#ghsjAndssfaPingShenInsert .table-doc-view tr,
.table-doc-view td {
  border: 1px solid #ccc;
  padding: 10px 10px;
}
#ghsjAndssfaPingShenInsert .table-doc-view td {
  font-size: 14px;
  color: #444;
  min-height: 30px;
}
#ghsjAndssfaPingShenInsert .table-doc-view .taoc-title {
  text-align: center;
  font-size: 18px;
  font-weight: bold;
}
#ghsjAndssfaPingShenInsert .table-doc-view .taoc-center {
  text-align: center;
}
#ghsjAndssfaPingShenInsert .boxItem_content_row_item_noFlex_textarea {
  width: 80%;
}
#ghsjAndssfaPingShenInsert .shencharen {
  display: flex;
  margin-right: 300px;
}
#ghsjAndssfaPingShenInsert .shencharen img {
  width: 105px;
  height: 59px;
}
#ghsjAndssfaPingShenInsert .shencharenTime {
  display: flex;
  align-items: center;
}
#ghsjAndssfaPingShenInsert .shencharenTime p {
  width: 80px;
}
#ghsjAndssfaPingShenInsert .boxItem_content_row_shenhe {
  margin: 30px 0;
}
#ghsjAndssfaPingShenInsert .tableBoxData_title {
  width: 100%;
  display: block;
  overflow: hidden;
  font-size: 20px;
  font-weight: bold;
  color: #444;
  text-align: center;
  margin-bottom: 10px;
}
.tableBoxData_mainData {
  width: 100%;
  display: flex;
  justify-content: center;
}
.tableBoxData_button_box {
  width: 100%;
  display: flex;
  justify-content: center;
}
.tableBoxData_button_box_item {
  margin: 0px 20px;
  margin-bottom: 20px;
  margin-top: 10px;
}
#ghsjAndssfaPingShenInsert .boxItem_content_row_child_second_item {
  margin-right: 12%;
}
#ghsjAndssfaPingShenInsert .boxItem_content_row_child_second_item p {
  width: 120px;
}
#ghsjAndssfaPingShenInsert >>> input::-webkit-outer-spin-button,
#ghsjAndssfaPingShenInsert >>> input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}
#ghsjAndssfaPingShenInsert >>> input[type="number"] {
  -moz-appearance: textfield;
}
.boxItem_content_row_item p:first-child {
  text-align: right;
  margin-right: 10px;
}
.boxItem_content_row_child_item p:first-child {
  text-align: right;
  margin-right: 10px;
}

.boxItem_content_title {
  margin-bottom: 20px;
}
.boxItem_content_title p {
  font-size: 14px;
  font-weight: bold;
  color: #606266;
}
.boxItem_content_row_item_input {
  width: 50%;
}
.freeTitle {
  font-size: 15px;
  font-weight: bold;
  color: #666;
}
.totalMoney {
  font-size: 16px;
  font-weight: bold;
  color: #333;
}
.marginBottom {
  margin-bottom: 20px;
}

.title {
  width: 100%;
  height: 50px;
  /* text-align: center; */
  font-weight: bold;
  margin-left: 30px;
  font-size: 16px;
  line-height: 50px;
  border-bottom: none;
  border-top: none;
}
.piankuaixinxi .title1 {
  width: 100%;
  height: 50px;
  text-align: center;
  font-size: 16px;
  line-height: 50px;
  border-bottom: none;
}
.uploadResult {
  font-size: 14px;
}
.uploadQuestionsTitle {
  color: #c40000;
}
.marginTop20 {
  margin-top: 15px;
}
.boxItem_content_row_item_input_input {
  width: 200px;
}
.pageStyle {
  text-align: center;
  margin: 20px;
}
</style>
 